﻿/*
 * Актор - Инкремент
 * */
using System;
using System.Collections.Generic;
using System.Text;
using ctem.kernel;
using ctem.kernel.lib;
using ctem.kernel.lib.ports.sequential;

namespace ctem.samples.actors.sequential
{
    public class IncActor : Actor
    {
        InPort inport;
        OutPort outport;
        
        public IncActor(string name):base(name)
        {
            inport = new InPort("inport",this);
            base.RegisterInport(inport);
            outport = new OutPort("outport", this);
            base.RegisterOutport(outport);
        }


        public override void Fire(double step)
        {
            //Console.WriteLine("Actor " + GetName() + " fired");
            List<IEntry> d = inport.Get();
            if (d.Count > 0)
                outport.Put(d[0].data.value + 1.0);
        }


    }
}
